package prehilife;

public class Main {

    static String typeOfGame;
    static boolean auto;
    static boolean graphicMode;
    static int AUTO_TIME;
    //static GUI gui;
    static AbstractGUI gui;

    public static void main(String[] args) {
        
        //gui = new GUI();
        //Entrance entre = new Entrance(gui, true);
        Entrance entre = new Entrance(true);
        entre.setVisible(true);
        configureGame(entre.type, entre.typeAff, entre.sizeGrid, entre.mam, entre.mem, entre.cave, entre.hut, entre.hp, entre.coll, entre.turn, entre.auto);
    }

    public static void configureGame(int typeOfGame, int typeAff, int size, int nbMam, int nbMem, int nbCave, int nbHut, int hp, int coll, int turn, boolean auto) {
        AbstractWorld world = WorldFactory.createWorld(typeOfGame);
        PrehiWorld w = (PrehiWorld) world;
        SimuLife simulifeGame = new SimuLife();
        w.createTable(size, size);
        w.configPrehiWorld(simulifeGame, nbMam, nbMem, nbCave, nbHut, hp, coll, turn, auto, graphicMode);
        if (typeAff == 0) {
            graphicMode = true;
        } else {
            graphicMode = false;
        }
        gui.configure(w, AUTO_TIME, auto, graphicMode);
      //  w.getGUI(gui);
        w.display();
        String endGameMsg=w.runGame();
        gui.drawEnd(endGameMsg);
        System.exit(0);
    }
}